/** * ExitLag Gaming Theme - Main JavaScript */ jQuery(document).ready(function($) { // Mobile Menu Toggle function toggleMobileMenu() { $('#mobileMenu').toggleClass('active'); } // Expose function globally window.toggleMobileMenu = toggleMobileMenu; // Close mobile menu when clicking outside $(document).on('click', function(event) { const $mobileMenu = $('#mobileMenu'); const $mobileMenuButton = $('.mobile-menu-button'); if (!$mobileMenu.is(event.target) && $mobileMenu.has(event.target).length === 0 && !$mobileMenuButton.is(event.target) && $mobileMenuButton.has(event.target).length === 0) { $mobileMenu.removeClass('active'); } }); // Smooth scrolling for anchor links $('a[href^="#"]').on('click', function(e) { e.preventDefault(); const target = $(this.getAttribute('href')); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top - 80 }, 800); } }); // Parallax effect for hero background $(window).on('scroll', function() { const scrolled = $(this).scrollTop(); $('.hero-bg-red, .hero-bg-purple').css({ 'transform': 'translateY(' + (scrolled * 0.5) + 'px)' }); }); // Game card hover effects with jQuery $('.game-card').hover( function() { $(this).css('transform', 'scale(1.05)'); }, function() { $(this).css('transform', 'scale(1)'); } ); // Animate elements on scroll function animateOnScroll() { $('.ambassador-card, .feature-card, .game-card').each(function() { const elementTop = $(this).offset().top; const elementBottom = elementTop + $(this).outerHeight(); const viewportTop = $(window).scrollTop(); const viewportBottom = viewportTop + $(window).height(); if (elementBottom > viewportTop && elementTop < viewportBottom) { $(this).addClass('animated'); } }); } // Add CSS for animations $('